package com.java.zhuiyun.api.propmgt.controller;

import com.java.zhuiyun.annotation.OptLog;
import com.java.zhuiyun.api.propmgt.entity.PropMgt;
import com.java.zhuiyun.api.propmgt.service.PropMgtService;
import com.java.zhuiyun.common.response.CommonConstants;
import com.java.zhuiyun.common.response.CommonResult;
import com.java.zhuiyun.util.pageUtil.PageRequest;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName PropMgtController
 * @Description TODO
 * @Author wuwan
 * @Date 2023/9/13 10:10
 **/
@RestController
@RequestMapping("/prop")
public class PropMgtController {
    @Autowired
    private PropMgtService propMgtService;
    /*
    * @Author wuwan
    * @Description 道具数据分页查询
    * @Date 2023/10/12 11:30
    * @Return
    */
    @GetMapping("/selectProp")
    @ApiOperation(value = "道具数据分页查询")
    @OptLog(modular = "道具管理",type = CommonConstants.SELECT,describe = "道具数据分页查询")
    public CommonResult selectProp(PageRequest pageRequest){
        CommonResult commonResult = propMgtService.selectProp(pageRequest);
        return CommonResult.ok(commonResult);
    }


    /*
    * @Author wuwan
    * @Description 添加道具
    * @Date 2023/9/13 10:39
    * @Return
    * @param null
    */
    @PostMapping("/addProp")
    @ApiOperation(value = "添加道具")
    @OptLog(modular = "道具管理",type = CommonConstants.ADD,describe = "添加道具")
    public CommonResult addProp(MultipartFile file, PropMgt propMgt){
        return CommonResult.ok(propMgtService.addProp(file,propMgt));
    }
    /*
     * @Author wuwan
     * @Description 道具修改道具
     * @Date 2023/9/13 10:39
     * @Return
     * @param null
     */
    @PostMapping("/updateProp")
    @ApiOperation(value = "道具修改道具")
    @OptLog(modular = "道具管理",type = CommonConstants.UPDATE,describe = "道具修改道具")
    public CommonResult updateProp(MultipartFile file, PropMgt propMgt){
        return CommonResult.ok(propMgtService.updateProp(file,propMgt));
    }
    /*
    * @Author wuwan
    * @Description 道具状态修改
    * @Date 2023/9/13 16:03
    * @Return
    * @param null
    */
    @PostMapping("/updateFlag")
    @ApiOperation(value = "道具状态修改")
    @OptLog(modular = "道具管理",type = CommonConstants.UPDATE,describe = "道具状态修改")
    public CommonResult updateFlag(PropMgt propMgt){
        CommonResult commonResult = propMgtService.updateFlag(propMgt);
        return CommonResult.ok(commonResult);
    }
}
